Transformation of Bi-Directional Packet Flow

ABSTRACT

A network packet includes a packet key that includes one or more source-destination field pairs. Each source-destination field pair that is included in the one or more source-destination field pairs includes a source field and a destination field. For each selected source-destination field pair, included in the one or more source-destination field pairs, a first section and a second section are selected in the packet key. A source field value is extracted from the source field and a destination field value is extracted from the destination field of the selected source-destination field pair.

This application is a continuation of U.S. patent application Ser. No.13/325,624, entitled “Bidirectional Packet Flow Transformation,” filedon Dec. 14, 2011, which claims priority to European Patent ApplicationNo. EP10306403, entitled “Bidirectional Packet Flow Transformation,”filed Dec. 14, 2010, the disclosures of which are hereby incorporatedherein by reference in their entirety for all purposes.

BACKGROUND

1. Field

This disclosure relates generally to packet flow and, more specifically,to bidirectional packet flow transformation.

2. Related Art

As network processors become more pervasive, technology is constantlydeveloping to provide more flexibility and improved capabilities withrespect to network packet processing features. Network processorsprocess and route packets formatted according to a given protocol (e.g.,transmission control protocol (TCP)), based on computations performed onpacket fields. A traditional limitation related to packet processing innetwork processors is packet flow bi-directionality. In general,existing network processors do not allow optimal identification offunctional packet flows for packets exchanged in either direction on aconnection.

For example, a TCP connection is essentially bidirectional since it isset-up as a reliable communication channel between two hosts (i.e., a“source” host initiating the TCP connection that triggers the connectionset-up process with an exchange of specific “sync” packets with a“destination” host that participates in the connection set-up process byresponding to the source host in a return IP path). Once the TCPconnection is established, the connection runs under a flow controlscheme that involves the exchange between the hosts of the positioninside the byte stream (windowing) and congestion information (“ack”).In sum, TCP exchange relies on symmetrical exchange of controlinformation between two hosts.

In general, some network processor applications are involved in themanagement of only one side of a network connection, while other networkprocessor applications are involved in the management of both sides ofthe network connection. For example, an “end-point” application istypically involved in the termination of a TCP connection, as anend-point application runs on only one of two hosts communicating overthe TCP connection. A major hardware off-load process in end-pointapplications is to classify incoming packets so that a receive queue isselected to receive all packets belonging to one or several TCPconnections. As another example, a “network node” application istypically involved in the interception of a TCP connection, as a networknode application runs in an intermediate point in the network to supportthe TCP connection between two hosts.

A common way to operate applications monitoring network connections isto expose them to the aggregation of all traffic received in a networknode. That is, all packets received from all ports of a networkprocessor are forwarded to the applications controlling the networknode. This implies that a network node application receives packets fromboth sides of a TCP connection, although each side is usually on adifferent port. Existing solutions do not allow a classification ofincoming packets by network connection independent of which port hasreceived the packet, i.e., a same classification usually cannot beperformed for packets related to the two sides of a same networkconnection. Accordingly, packets of both sides of the network connectioncannot be easily managed to be received in a same receive queue and/orsent for final processing to a same processing core or thread.

SUMMARY

According to one aspect of the present disclosure, a technique forprocessing a network packet includes receiving the network packet. Thenetwork packet includes a packet key that includes one or moresource-destination field pairs. Each source-destination field pair thatis included in the one or more source-destination field pairs includes asource field and a destination field. For each selectedsource-destination field pair included in the one or moresource-destination field pairs a first section and a second section areselected in the packet key. A source field value is extracted from thesource field and a destination field value is extracted from thedestination field of the selected source-destination field pair. Foreach source bit of the source field value: a destination bit located ata same bit position as the source bit is selected from the destinationfield; an OR logic function is applied to the source bit and thedestination bit to generate a first resulting value; the first resultingvalue is stored at the same bit position as the source bit in the firstsection; an AND logic function is applied to the source bit and thedestination bit to generate a second resulting value; and the secondresulting value is stored at the same bit position as the source bit inthe second section.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example and is notintended to be limited by the accompanying figures, in which likereferences indicate similar elements. Elements in the figures areillustrated for simplicity and clarity and have not necessarily beendrawn to scale.

FIG. 1 is a diagram of a relevant portion an exemplary networkarchitecture for a network processor that implements a hasher configuredaccording to the present disclosure;

FIG. 2 is a diagram of a relevant portion of an exemplary hasheremployed in the network architecture of FIG. 1;

FIG. 3 is a diagram of an exemplary packet 5-tuple;

FIG. 4 is a diagram of an exemplary packet key forming a 5-tupleaccording to a transmission control protocol/Internet protocol (TCP/IP);

FIG. 5 is a flowchart of an exemplary process for selectivelytransforming a data packet according to the present disclosure; and

FIG. 6 is a diagram of a relevant portion of an exemplary packettransformation device configured according to the present disclosure.

DETAILED DESCRIPTION

As will be appreciated by one of ordinary skill in the art, the presentinvention may be embodied as a method, system, device, or computerprogram product. Accordingly, the present invention may take the form ofan embodiment including hardware, an embodiment including software(including firmware, resident software, microcode, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a circuit, module, or system. Thepresent invention may, for example, take the form of a computer programproduct on a computer-usable storage medium having computer-usableprogram code, e.g., in the form of one or more design files, embodied inthe medium.

Any suitable computer-usable or computer-readable storage medium may beutilized. The computer-usable or computer-readable storage medium maybe, for example, but is not limited to, an electronic, magnetic,optical, electromagnetic, infrared, or semiconductor system, apparatus,or device. More specific examples (a non-exhaustive list) of thecomputer-readable storage medium include: a portable computer diskette,a hard disk, a random access memory (RAM), a read-only memory (ROM), anerasable programmable read-only memory (EPROM) or flash memory, aportable compact disc read-only memory (CD-ROM), an optical storagedevice, or a magnetic storage device. As used herein the term “coupled”includes a direct electrical connection between elements or blocks andan indirect electrical connection between elements or blocks achievedusing one or more intervening elements or blocks.

According to the present disclosure, generation of identical resultingkeys (in which some or all pairs of fields are made bitwise symmetric)is employed such that swapping of bits in the fields of input keys leadsto the same resulting output keys. In this manner, bidirectional flowsare associated when destination and source field pairs (e.g., address orport fields) are interchanged.

Embodiments of the present disclosure provide a packet transformationdevice for selectively transforming source-destination field pairs of abidirectional packet flow so that a same flow identifier is generatedfor both packet flow directions. Each source-destination field pairrelates to a network parameter. This includes, for example, thesource-destination address pair for an address parameter (e.g., Internetprotocol (IP) addresses) and the source-destination port pair for a portparameter (e.g., transmission control protocol (TCP) ports).

FIG. 1 shows an exemplary hasher 100 that includes a packet parser 11, apacket transformation device 15, and a hashing unit 17 that areconfigured according to aspects of the present disclosure. Hasher 100may, for example, be implemented within a network processor. Hasher 100produces a value (referred to as a hashing value or a flow identifier)that permits identification of a packet to a degree of granularity. Itshould be appreciated that packet transformation device 15 may beemployed in other network processor components to transform a datapacket into a symmetric packet. It should also be appreciated that theterm ‘symmetric’ as used herein refers to a transformed packet thatprovides the same values for at least one source-destination pair forboth packet flow directions (i.e., from source-to-destination and fromdestination-to-source). The term ‘packet’ as used herein encompassesdata exchanged in a variety of networks and includes a header andpayload featured according to a suitable communication protocol (e.g.,TCP/IP, UDP, etc.). Hashser 100 is generally more flexible thanconventional hashers used in conventional network processors.

Flexibility of hash functions implemented by a hasher may depend on theway in which a hash key (hasher input) is assembled, or the propertiesof the hash function. Conventionally, flexibility in key assembly hasbeen achieved in software implementations of hashers, while flexiblehash functions have usually involved some form of configurable hardwarehasher implementation. In general, software key assemblies haveperformance limitations when complex patterns are required to build thehash key (in particular, when the key assembly is done at bit-levelgranularity). Additionally, configurable hardware hash functions usuallyhave silicon area limitations due to the configuration logicimplementing the base hashing elements (typically implemented withexclusive OR (XOR) gates). Typically, the limitations are more severewhen a hasher is used to identify packet flows on very high-speedinterfaces (e.g., 10 Gbps or more), mainly due to very short packetperiodicity (e.g., 67.2 ns or less).

Existing hashers do not allow optimal identification of functionalpacket flows for packets exchanged in either direction on a link. Forsuch hasher applications, it is desirable for a hasher to generate asame hashed value from the two forms of keys corresponding to the twosides of a connection. According to the present disclosure, packettransformation device 15 is configured to facilitate identification ofboth flows of a same bidirectional packet with a same flow identifier.Packet transformation device 15 may be manually configurable to operateon a set of connection-related fields (address, port). Alternatively,packet transformation device 15 may be automatically configured based onpredefined conditions. For example, in an application where a parser mayneed to handle user datagram protocol (UDP) packets in a symmetrical wayand TCP packets in a regular way, the predefined conditions may includepreviously determining if the layer protocol is UDP or TCP protocol. Inthis manner, pair transformation is facilitated for a packet subject toprotocol recognition (e.g., facilitated via a protocol field).

In general, packet transformation device 15 relies on bitwise processingof values maintained in source and destination positions of a same fieldin a packet key. Hasher 100 includes a parser 11 for extracting bytesfrom headers (and/or payloads of received data packets 10) andtransmitting resulting packet data (referred to hereafter as a packetkey) 12 to packet transformation device 15. Packet transformation device15 selectively transforms packet key 12 into a transformed packet key 16having one or more symmetrical source-destination field pairs. Thesymmetric or transformed packet key 16 is then provided to hashing unit17, which produces a flow identifier (hash value) 18 from thetransformed packet key 16 that permits identification of a packet to adegree of granularity and the assignment of the packet to a particularreceive or transmit queue according to predefined rules (e.g., likepackets are assigned to a same queue).

In particular, hashing unit 17 generates a same flow identifier 18 fordata packets corresponding to two directions of a same connection. Flowidentifier 18 may be used to access data structures though a hash tableand retrieve information for the processing of the packet to determinewhich interfaces should receive a packet corresponding to a particularflow. In general, packet identifiers are computed for each packetprocessed by a network processor.

FIG. 2 illustrates a detailed view of the hasher 100 represented inFIG. 1. As shown, parser 11 includes one or more parser registers 110(e.g., 16-byte registers for a TCP connection) that are individuallyaddressable, in order to be loaded by parser 11 according to apredefined order. The order in which the various bytes are loaded may bedetermined by the amount of information included in each extracted bytethat can contribute to flow identification. Parser 11 includes a parsercontrol module 112 for extracting information from register 110 andproviding the information to packet transformation device 15. Parsercontrol module 112 may map the information extracted from the packetonto a standard input structure, referred to herein as a ‘packet key’.Hasher 100 includes a distribution bus 115 to provide the packet flowinput to packet transformation device 15.

Distribution bus 115 is configured to fill any input of packettransformation device 15 bytewise from packet parser 11. In this manner,packet transformation device 15 can similarly process a packetcorresponding to a same connection independent of packet flow direction.In general, a connection includes two flows, one in each directionbetween two nodes of the network. Typically, a packet flow includes anumber of connection related fields (which have a source value and adestination value) on top of other fields. In various embodiments,several fields may be extracted from a packet in order to build an inputkey for hashing unit 17.

In one or more embodiments, hashing unit 17 (also referred to herein asa hasher cone or a hasher combinatorial cone) provides a combinatorialcone of logic based on exclusive OR (XOR) gates that combine all bits ofa 128-bit hash key and produce a resulting 32-bit hash value. Hashingunit 17 generally includes configuration logic that implements the basehashing elements (typically implemented with a combination of XORgates). An output of hashing unit 17 may be used for identifying packetflows on very high-speed interfaces (10 Gbps or more), when packetperiodicity is short (67.2 ns or less). It should be appreciated thatdifferent patterns may be used to build a hash key (e.g., when keyassembly is done at bit-level granularity and configurable hardware hashfunctions have silicon area limitations).

FIG. 3 illustrates an exemplary 5-Tuple key 300 that includesinformation extracted from a data packet flowing from a source node to adestination node over a network. In general, packet flow is defined by asource address (SA) 301, a destination address (DA) 303, a source port(SP) 302, a destination port (DP) 304, and a protocol (Proto) 305. Itshould be appreciated that a source and destination value of a samefield (e.g., address or port) are reversed for packet flowscorresponding to opposite directions. In general, an address parametermay be formatted according to any communication protocol, e.g., Internetprotocol version 4 (IPv4), Internet protocol version 6 (IPv6), mediaaccess control (MAC), transmission control protocol (TCP), user datagramprotocol (UDP), etc. For example, in a TCP connection or a UDPconnection, a 5-Tuple packet flow 300 includes: a source address 301(e.g., with four bytes in an IPv4 header and sixteen bytes in an IPv6header); a destination address 303 (e.g., with four bytes in an IPv4header and sixteen bytes in an IPv6 header); a protocol field 305 (e.g.,with one byte for an IP header and a value of ‘6’ for a TCP connectionand a value of ‘17’ for a UDP connection); a source port 302 (e.g., withtwo bytes for a TCP or UDP header); and a TCP/UDP destination port 304(e.g., with two bytes for a TCP or UDP header).

FIG. 4 shows another exemplary key that may form a standard hasher inputdata structure 400 for a network processor. As shown in FIG. 4, thestandard hasher input structure 400 includes sixteen bytes. A firstsection 401 includes four bytes that are used for IP source addresses(IP SA). A second section 402 includes two bytes that are used for TCPsource port (TCP SP) values. A third section 403 includes two bytes thatare used for multi-protocol label switching (MPLS) values. A fourthsection 404 includes four bytes that are used for IP destinationaddresses (IP DA). A fifth section 405 includes two bytes that are usedfor TCP destination port (TCP DP) values. A sixth section 406 includesfour bits that are used for MPLS values in continuation with thirdsection 403. A seventh section 407 includes four bits that are reserved.Finally, an eighth section 408 includes one byte that is used forprotocol (Prot) values.

Similar to 5-Tuple key 300 of FIG. 3, data structure 400 of FIG. 4includes two source-destination field pairs, i.e., a firstsource-destination field pair for the address parameter and a secondsource-destination field pair for the port parameter. According to thepresent disclosure, a transformation is performed on preselectedsource-destination field pairs associated with respective parameters. Anexemplary source-destination field pair in an IP connection is theaddress pair comprising an IP source address (IP SA) and an IPdestination address (IP DA). In a TCP connection, an exemplarysource-destination field pair is the port pair that includes the sourceport (TCP SP) and the destination port (TCP DP).

According to the present disclosure, the source and destination valuesof the source-destination field pairs are swapped in the headers of thepackets received on the two sides of the connection. For example, a TCPconnection between two hosts A and B will carry packets with thefollowing 5-tuples: two source-destination field pair including {Ia, Ib}for the first flow direction and {Ib, Ia} for the other flow direction;{Ta,Tb} for the first flow direction and {Tb, Ta} for the other flowdirection. That is, a first flow from host A to host B includes Ia Ib PTa Tb and a second flow from host B to host A includes Ib Ia P Tb Ta.According to the present disclosure, the transformation of a packet keyis achieved by reordering the bits of the source and destination valuesof a given pair. That is, each bit of the source field of the pair isreplaced with the largest bit among the source bit and the correspondingdestination bit in the destination field (i.e., the bits are ORed) andeach bit of the destination field of the pair is replaced with thelowest bit among the source bit and the corresponding destination bit inthe destination field of the pair (i.e., the bits are ANDed).Alternatively, the largest bit may be stored to the destination fieldand the lowest bit may be stored to the source field at the same bitposition.

FIG. 5 shows a flowchart for performing a symmetric transformationprocess of one or more preselected source-destination pairs of a samefield according to one or more embodiments of the present disclosure.The process is initiated at block 500 when an input packet key 12 isreceived by packet transformation device 15. Packet key 12 includessource-destination field pairs related to respective parameters such as,in the exemplary data structure of FIGS. 3 and 4, the pair {sourceaddress, destination address} for the address fields, or the pair{source port, destination port} for the port fields, as well asadditional fields (e.g., a protocol field (Prot)) depending on theprotocol. In block 502, packet transformation device 15 determines whichof the source-destination field pairs have an enabled state. An enabledstate may be manually activated by a user or automatically activatedbased on predefined conditions to identify the pairs that are to betransformed by packet transformation device 15.

In block 504, for each enabled source-destination field pair, packettransformation device 15 retrieves the source field value (e.g., the4-byte source address) and the destination field value (e.g. the 4-bytedestination address). Next, in block 506, packet transformation device15 iterates blocks 508 to 516 for each bit of the pair source field. Inblock 508, for the current bit ‘ai’ of the source field value (referredto hereafter as the ‘source bit’), the bit ‘bi’ corresponding to thesame position in the destination field value (referred to hereafter asthe ‘destination bit’) is selected. In block 510, packet transformationdevice 15 applies an OR logical function between the source bit ‘ai’ andthe corresponding destination bit ‘bi’ to provide a first resulting bitvalue ‘cij’. In block 512, the original bit ‘ai’ of the pair sourcefield is replaced with the first resulting bit value ‘cij’.

In block 514, packet transformation device 15 applies an AND logicalfunction between the source bit ‘ai’ and the corresponding destinationbit ‘bi’ to provide a second resulting value ‘dij’. In block 516, theoriginal bit ‘bi’ of the pair destination field is replaced with thesecond resulting bit value ‘di’. Alternatively, resulting bit ‘cij’obtained in block 510 (OR function) may be stored in the destinationfield (at the same bit position) and the resulting bit ‘dij’ obtained inblock 514 (AND function) may be stored in the source field (at the samebit position).

In block 518, the next bit in the source field of the current pair isselected if all of the bits (e.g. 32-bits) have not been processed inblock 517, and blocks 508 to 514 are repeated. If packet transformationdevice 15 determines in block 517 that all the bits of the current pairhave been processed, control transfers to block 519. In block 519, inresponse to not all of the field pairs being processed, controltransfers to block 520 where packet transformation device 15 selects thenext enabled source-destination field pair that is to be processed. Fromblock 520 control transfers to block 504 and then to block 506.Accordingly, for each enabled field pair, the source bit is replacedwith the largest bit among the source bit and the destination bit andthe destination bit is replaced with the lowest bit among the source bitand the destination bit.

In this manner, packet transformation device 15 facilitatesidentification of packets relating to a same connection (flow fromsource-to-destination and from destination-to-source). Thetransformation performed by packet transformation device 15 enableshasher 100 to equally identify bidirectional flows when destination andsource values of a same connection related field in a same packet floware interchanged. As a result, a same hashed value can be generated bythe hashing function employed in hashing unit 17 when an input key isassembled with source and destination fields swapped. For example, forflows exchanged between systems at IP addresses A and B, the same hashedvalue can be generated when the input key contains DA=A and SA=B andwhen the input key contains DA=B and SA=A. This also applies to TCP/UDPsource and destination ports, or to other source-destination fieldpairs.

For example, bitwise operations may be performed according to the tablebelow, where ‘ai’ is the current bit of the source field (e.g., SA orSP), ‘bi’ is the corresponding bit of the destination field (e.g., DA orDP), ‘cij’ is the resulting reordered bit (‘ai’ OR ‘bi’) of the firstreordered value and ‘dij’ is the resulting reordered bit of the secondreordered value (‘ai’ AND ‘bi’).

cij dij ai bi (=ai OR bi) (=ai AND bi) 0 0 0 0 1 0 1 0 0 1 1 0 1 1 1 1In general, solutions according to the present disclosure improve ahardware implementation of a hasher for TCP connections and minimizesthe silicon area required for the hasher, without requiring complex bitsubtractors (e.g., 32-bit and 16-bit subtractors) to perform comparisonsof source-destination field pairs (e.g. 4-byte IP addresses, 2-byte TCPports).

FIG. 6 shows an exemplary structure for packet transformation device 15according to one or more certain embodiments of the present disclosure.Packet transformation device 15 receives a packet key 12 that includesdata extracted from a data packet transmitted from a source node to adestination node according to a given protocol. Packet key 12 includes anumber of source-destination field pairs 121, e.g., {SF1, DF1}, {SF2,DF2},{SF3, DF3}, where SFj designates source field 1210 and DFjdesignates destination field 1211 of pair j. Packet key 12 alsocomprises pair enablement information 120 to facilitate identificationof the enabled pair. For illustrative purpose, the enabled pair {SF1,DF1} and {SF3, DF3} are represented with dotted backgrounds. Packettransformation device 15 may also include additional informationdepending on the communication protocol. Pair enablement information 120may include a number of control bits associated with a given field pairor alternatively a number of control bits associated with respectivebytes of a packet.

It should be understood that the arrangement of the different fields ofa packet key (including the pair enablement information bits) are forillustrative purposes. Packet transformation device 15 includes anenabled pair detector 150 which is provided to indicate whether thefield pairs are in an enabled state. Packet transformation device 15also includes a bit selector 151 (to select the corresponding bits ofthe source field and the destination field of each detected pair), an ORgate 1520 (for applying the OR function to each bit ‘ai’ of the sourcefield of an enabled pair and the corresponding bit ‘bi’ of thedestination field of the pair and providing the first resulting value‘cij’). Packet transformation device 15 also includes an AND gate 1521(for applying the AND function to each bit ‘ai’ of the source field ofan enabled pair with the corresponding bit ‘bi’ of the destination fieldof the pair and providing the second resulting value ‘dij’).

In some situations, the transformation may not be deterministic.However, whether the transformation is non-deterministic is irrelevantas the hasher is non-deterministic by nature. According to variousembodiments, field pairs may be manually or automatically configured sothat only the enabled pairs are selected for the transformation.Accordingly packet transformation may be adapted to the type ofapplication in which the hasher is used. For example, in mixed-modeenvironments, i.e., applications with variable symmetry requirements,the configuration may be defined per port. In order to preserve theflexibility offered to the parser for assembling the hash keys, theenablement of the symmetry transformation may not be done per fieldpair, but instead per pair of bytes.

In one exemplary embodiment (see the data structure of FIG. 3), eachinput register 110 where parser 11 assembles the hash key is 16-byteslong (byte 0 to byte 15), structured as eight pairs of 1-byte registers(bytes 0-8, bytes 1-9, etc). A configuration register that may be usedper port holds an 8-bit value (bit 0 to bit 7) to enable symmetrytransformation of each of the eight pairs of bytes of the input register(e.g., bit 0 enables symmetry for bytes 0-8; bit 1 enables symmetry forbytes 1-9; bit 7 enables symmetry for bytes 7-15, etc.). Alternatively,instead of using enablement information 120 comprising one control bitper byte pair (i.e., eight control bits for the data structure of FIG.4), enablement information 120 may comprise one control bit per bit pair(i.e., 32-bits for the data structure of FIG. 4).

In general, the disclosed embodiments provide an efficient solution thatallows processing of two flows of a same packet while optimizinghardware area. In hasher applications, the disclosed transformationusually speeds up a look-up process in a hash table associated with thehasher. Accordingly, a network processor has been described herein thatreadily facilitates identification of packets related to a sameconnection in a bidirectional manner.

The flowchart and block diagrams in the figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a,” “an,” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” (and similar terms, such as includes, including,has, having, etc.) are open-ended when used in this specification,specify the presence of stated features, integers, steps, operations,elements, and/or components, but do not preclude the presence oraddition of one or more other features, integers, steps, operations,elements, components, and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below, if any, areintended to include any structure, material, or act for performing thefunction in combination with other claimed elements as specificallyclaimed. The description of the present invention has been presented forpurposes of illustration and description, but is not intended to beexhaustive or limited to the invention in the form disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the invention.The embodiment was chosen and described in order to best explain theprinciples of the invention and the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

Having thus described the invention of the present application in detailand by reference to preferred embodiments thereof, it will be apparentthat modifications and variations are possible without departing fromthe scope of the invention defined in the appended claims.

1. A method for processing a network packet, comprising: receiving, by apacket transformation device, the network packet, wherein the networkpacket includes a packet key that includes one or moresource-destination field pairs, and wherein each source-destinationfield pair that is included in the one or more source-destination fieldpairs includes a source field and a destination field; for each selectedsource-destination field pair included in the one or moresource-destination field pairs: selecting, by the packet transformationdevice, a first section and a second section in the packet key; andextracting, by the packet transformation device, a source field valuefrom the source field and a destination field value from the destinationfield of the selected source-destination field pair; for each source bitof the source field value: selecting, by the packet transformationdevice, from the destination field value, a destination bit located at asame bit position as the source bit; applying, by the packettransformation device, an OR logic function to the source bit and thedestination bit to generate a first resulting value; storing, by thepacket transformation device, the first resulting value at the same bitposition as the source bit in the first section; applying, by the packettransformation device, an AND logic function to the source bit and thedestination bit to generate a second resulting value; and storing, bythe packet transformation device, the second resulting value at the samebit position as the source bit in the second section.
 2. The method ofclaim 1, wherein the first section corresponds to a source field sectionof the selected source-destination field pair and the second sectioncorresponds to a destination field section of the selectedsource-destination field pair.
 3. The method of claim 1, wherein thefirst section corresponds to a destination field section of the selectedsource-destination field pair and the second section corresponds to asource field section of the selected source-destination field pair. 4.The method of claim 1, wherein the packet key further includes pairenablement information and the selected source-destination field pair isdetermined from the pair enablement information.
 5. The method of claim4, wherein the pair enablement information includes a control bit foreach of the source-destination field pairs, and wherein the methodfurther includes selecting the selected source-destination field pair inresponse to a value of the control bit associated with selectedsource-destination field pair matching a predefined value.
 6. The methodof claim 4, wherein the pair enablement information includes controlbits associated with respective sets of bytes in the packet key, andwherein the method further includes selected the selectedsource-destination field pair in response to values of the control bitsassociated with the bytes of the selected source-destination field pairmatching a predefined value.
 7. The method of claim 6, wherein thepacket key is provided from a set of registers adapted to extract datafrom the network packet and each register of the set of registers has apredefined byte size and is arranged to feed a predefined section of thepacket key, and wherein a control bit is received from each register inassociation with the bytes provided by the register to the networkpacket.
 8. The method of claim 4, wherein the pair enablementinformation includes control bits associated with respective pair ofbits in the packet key, and wherein the method further includesselecting the selected source-destination field pair when bit controlvalues associated with the bits of the selected source-destination fieldpair match a predefined value.
 9. The method of claim 4, wherein thepair enablement information is manually configurable.
 10. The method ofclaim 4, wherein the pair enablement information is automaticallyconfigurable based on predefined conditions.
 11. A hasher, comprising: apacket parser configured to receive a network packet, wherein thenetwork packet includes a packet key that includes one or moresource-destination field pairs, and wherein each source-destinationfield pair that is included in the one or more source-destination fieldpairs includes a source field and a destination field; a packettransformation device coupled to the packet parser, wherein the packettransformation device is configured to: for each selectedsource-destination field pair included in the one or moresource-destination field pairs: select a first section and a secondsection in the packet key; and extract a source field value from thesource field and a destination field value from the destination field ofthe selected source-destination field pair; and for each source bit ofthe source field value: select, from the destination field value, adestination bit located at a same bit position as the source bit; applyan OR logic function to the source bit and the destination bit togenerate a first resulting value; store the first resulting value at thesame bit position as the source bit in the first section; apply an ANDlogic function to the source bit and the destination bit to generate asecond resulting value; and store the second resulting value at the samebit position as the source bit in the second section.
 12. The hasher ofclaim 11, wherein the first section corresponds to a source fieldsection of the selected source-destination field pair and the secondsection corresponds to a destination field section of the selectedsource-destination field pair.
 13. The hasher of claim 11, wherein thefirst section corresponds to a destination field section of the selectedsource-destination field pair and the second section corresponds to asource field section of the selected source-destination field pair. 14.The hasher of claim 11, wherein the packet key further includes pairenablement information and the selected source-destination field pair isdetermined from the pair enablement information.
 15. The hasher of claim14, wherein the pair enablement information includes a control bit foreach of the source-destination field pairs, and wherein the hasher isfurther configured to select the selected source-destination field pairin response to a value of the control bit associated with selectedsource-destination field pair matching a predefined value.
 16. Thehasher of claim 14, wherein the pair enablement information includescontrol bits associated with respective sets of bytes in the packet key,and wherein the hasher is further configured to select the selectedsource-destination field pair in response to values of the control bitsassociated with the bytes of the selected source-destination field pairmatching a predefined value.
 17. The hasher of claim 16, wherein thepacket key is provided from a set of registers adapted to extract datafrom the network packet and each register of the set of registers has apredefined byte size and is arranged to feed a predefined section of thepacket key, and wherein a control bit is received from each register inassociation with the bytes provided by the register to the networkpacket.
 18. The hasher of claim 14, wherein the pair enablementinformation includes control bits associated with respective pair ofbits in the packet key, and wherein the hasher is further configured toselect the selected source-destination field pair when bit controlvalues associated with the bits of the selected source-destination fieldpair match a predefined value.
 19. The hasher of claim 14, wherein thepair enablement information is manually configurable.
 20. The hasher ofclaim 14, wherein the pair enablement information is automaticallyconfigurable based on predefined conditions.
 21. A hasher, comprising: apacket parser configured to receive a network packet, wherein thenetwork packet includes a packet key that includes one or moresource-destination field pairs, and wherein each source-destinationfield pair that is included in the one or more source-destination fieldpairs includes a source field and a destination field, where the packetparser includes a set of registers for storing the packet key and thepacket key further includes pair enablement information; a packettransformation device coupled to the packet parser, wherein the packettransformation device is configured to: select a source-destinationfield pair based on the pair enablement information and for eachselected source-destination field pair included in the one or moresource-destination field pairs: select a first section and a secondsection in the packet key; and extract a source field value from thesource field and a destination field value from the destination field ofthe selected source-destination field pair; and for each source bit ofthe source field value: select, from the destination field value, adestination bit located at a same bit position as the source bit; applyan OR logic function to the source bit and the destination bit togenerate a first resulting value; store the first resulting value at thesame bit position as the source bit in the first section; apply an ANDlogic function to the source bit and the destination bit to generate asecond resulting value; and store the second resulting value at the samebit position as the source bit in the second section.